using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class education_joinMap : EntityTypeConfiguration<education_join>
    {
        public education_joinMap()
        {
            // Primary Key
            this.HasKey(t => t.education_join_id);

            // Properties
            this.Property(t => t.comments)
                .HasMaxLength(80);

            this.Property(t => t.User_ID)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("education_join");
            this.Property(t => t.education_information_id).HasColumnName("education_information_id");
            this.Property(t => t.education_join_id).HasColumnName("education_join_id");
            this.Property(t => t.join_count).HasColumnName("join_count");
            this.Property(t => t.comments).HasColumnName("comments");
            this.Property(t => t.User_ID).HasColumnName("User_ID");
            this.Property(t => t.registration_time).HasColumnName("registration_time");
            this.Property(t => t.is_join_actual).HasColumnName("is_join_actual");

            // Relationships
            this.HasRequired(t => t.education_information)
                .WithMany(t => t.education_join)
                .HasForeignKey(d => d.education_information_id);
            this.HasOptional(t => t.user)
                .WithMany(t => t.education_join)
                .HasForeignKey(d => d.User_ID);

        }
    }
}
